﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Auros.Categorisation.Umbraco
{
    public static class UIHelpers
    {
        private static string NotFoundFormatting = "[{0}]";

        public static string GetLocalisedText(string key, string group, string defaultValue = null)
        {
            string uiText = umbraco.ui.Text(group, key);

            if (defaultValue != null && (String.IsNullOrEmpty(uiText) || uiText == String.Format(NotFoundFormatting, key)))
                return defaultValue;

            return uiText;
        }
    }
}